function submit()
  addpath('./lib');

  conf.assignmentKey = 'rGGTuM9gQoaikOnlhLII1A';
  conf.itemName = 'K-Means Clustering and PCA';
  conf.partArrays = { ...
    { ...
      '7yN0U', ...
      { 'findClosestCentroids.m' }, ...
      'Find Closest Centroids (k-Means)', ...
    }, ...
    { ...
      'G1WGM', ...
      { 'computeCentroids.m' }, ...
      'Compute Centroid Means (k-Means)', ...
    }, ...
    { ...
      'ixOMV', ...
      { 'pca.m' }, ...
      'PCA', ...
    }, ...
    { ...
      'AFoJK', ...
      { 'projectData.m' }, ...
      'Project Data (PCA)', ...
    }, ...
    { ...
      'vf9EL', ...
      { 'recoverData.m' }, ...
      'Recover Data (PCA)', ...
    }, ...
  };
  conf.output = @output;

  submitWithConfiguration(conf);
end

function out = output(partId, auxstring)
  % Random Test Cases
  X = reshape(sin(1:165), 15, 11);
  Z = reshape(cos(1:121), 11, 11);
  C = Z(1:5, :);
  idx = (1 + mod(1:15, 3))';
  if partId == '7yN0U'
    idx = findClosestCentroids(X, C);
    out = sprintf('%0.5f ', idx(:));
  elseif partId == 'G1WGM'
    centroids = computeCentroids(X, idx, 3);
    out = sprintf('%0.5f ', centroids(:));
  elseif partId == 'ixOMV'
    [U, S] = pca(X);
    out = sprintf('%0.5f ', abs([U(:); S(:)]));
  elseif partId == 'AFoJK'
    X_proj = projectData(X, Z, 5);
    out = sprintf('%0.5f ', X_proj(:));
  elseif partId == 'vf9EL'
    X_rec = recoverData(X(:,1:5), Z, 5);
    out = sprintf('%0.5f ', X_rec(:));
  end 
end
